<?php
include "fonctions.php";
session_start();
if(isset($_SESSION['idUtil']))
{
  if(isset($_POST['brouillons']))
  {
    db_connect();
	echo $_POST['brouillons'];
	$brouillons = explode(",",$_POST['brouillons']);
	echo $brouillons[0];
	foreach ($brouillons as &$brouillon){
	  $req = "SELECT path FROM articles WHERE idArticle='".$brouillon."';";	  $req = mysql_query($req) or die (mysql_error());	  $path = mysql_fetch_array($req);	  $path = $path[0];
	  if(file_exists($path))
	  {
	    unlink($path);
	  }
	  $req='DELETE FROM articles WHERE  idArticle=\''.$brouillon.'\';';
	  $res  = mysql_query($req) or die (mysql_error());
	}
  }
}
?>
